//
//  YGGrayVIew.m
//  yuanshangyiliao
//
//  Created by icholab on 2021/3/21.
//

#import "YGGrayVIew.h"

@interface YGGrayVIew ()
@property (nonatomic, strong) UIView *lineView;
@property (nonatomic, strong) UIButton *cutdownBtn;
@property (nonatomic, strong) UIButton *patientconditionBtn;
@property (nonatomic,strong) UIButton *locallogoBtn;

@end

@implementation YGGrayVIew

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self initView];
        [self initContraints];
    }
    return self;
}

- (void)initView{
    
    [self addSubview:self.locallogoBtn];
    [self addSubview:self.cutdownBtn];
    [self addSubview:self.lineView];
    [self addSubview:self.patientconditionBtn];
   
    
}


- (void)initContraints{
    
    [self.locallogoBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.mas_left).offset(3.5);
            make.centerY.mas_equalTo(self.centerY);
            make.width.mas_equalTo(20);
            make.height.mas_equalTo(20);
    }];
    
    [self.cutdownBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.locallogoBtn.mas_right).offset(3.5);
            make.centerY.mas_equalTo(self.locallogoBtn.mas_centerY);
            make.height.mas_equalTo(9.5);
            make.width.mas_equalTo(50);
    }];
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.cutdownBtn.mas_right).offset(8);
            make.height.mas_equalTo(9.5);
            make.centerY.mas_equalTo(self.locallogoBtn.mas_centerY);
            make.width.mas_equalTo(0.5);
    }];

    [self.patientconditionBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.lineView.mas_right).offset(3.5);
            make.height.mas_equalTo(9.5);
            make.centerY.mas_equalTo(self.locallogoBtn.mas_centerY);
            make.width.mas_equalTo(50);
    }];
}

-(void)clickAction{
    
}

#pragma setter
- (UIView *)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = UIColorFromRGB(0x333333);
    }
    return _lineView;
}

- (UIButton *)locallogoBtn{
    if (!_locallogoBtn) {
        _locallogoBtn =[[UIButton alloc]init];
        [_locallogoBtn addTarget:self action:@selector(clickAction) forControlEvents:UIControlEventTouchUpInside];
        [_locallogoBtn setBackgroundImage:[UIImage imageNamed:@"local_logo_icon"] forState:UIControlStateNormal];
    }
    return _locallogoBtn;
}

- (UIButton *)cutdownBtn{
    if (!_cutdownBtn) {
        _cutdownBtn = [[UIButton alloc] init];
        [_cutdownBtn addTarget:self action:@selector(clickAction) forControlEvents:UIControlEventTouchUpInside];
        [_cutdownBtn setTitle:@"切换医院" forState:UIControlStateNormal];
        _cutdownBtn.titleLabel.font = [UIFont systemFontOfSize:12];
        _cutdownBtn.titleLabel.textColor=[UIColor whiteColor];
       
    }
    return _cutdownBtn;
}

- (UIButton *)patientconditionBtn{
    if (!_patientconditionBtn) {
        _patientconditionBtn = [[UIButton alloc]init];
        [_patientconditionBtn addTarget:self action:@selector(clickAction) forControlEvents:UIControlEventTouchUpInside];
        [_patientconditionBtn setTitle:@"住院中" forState:UIControlStateNormal];
        _patientconditionBtn.titleLabel.font = [UIFont systemFontOfSize:12];
        _patientconditionBtn.titleLabel.textColor=[UIColor whiteColor];
    }
    return _patientconditionBtn;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
